<!DOCTYPE html>
<html>
  
<!-- Mirrored from www.dba.cn/book/electron/ELECTRONJiaoCheng/ELECTRONZhiChiDeCHROMEMingLingXingKaiGuan.html by HTTrack Website Copier/3.x [XR&CO'2014], Sun, 20 Mar 2022 10:24:03 GMT -->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Electron 支持的 Chrome 命令行开关 - Electron中文手册</title>
    <link rel="stylesheet" type="text/css" href="../../skins/cms/css/min-easyui.css">
    <link rel="stylesheet" type="text/css" href="../../skins/cms/css/book.css">
    <script type="text/javascript" src="../../js/jquery.min.js"></script>
    <script type="text/javascript" src="../../skins/cms/js/m-easyui.js"></script>
    <script type="text/javascript" src="../../skins/cms/js/prettify.js"></script>
  </head>
  <body class="easyui-layout" style="text-align:left">
    <div region="north" border="false" class="group wrap header" style="height:66px;font-size:100%">
      <div class="header">
        <div class="navigation-toggle" data-tools="navigation-toggle" data-target="#navbar-1">
          <span>Electron中文手册</span>
        </div>
        <div id="elogo" class="navbar navbar-left">
          <ul>
            <li>
              <h1><a href="../index.html">Electron中文手册</a></h1>
            </li>
          </ul>
        </div>
      <div style="clear:both"></div>
    </div>
   </div>
    <div region="west" split="true" data-options="collapsedSize:0,hideExpandTool:true" title="文档目录" style="width:20%;min-width:300px;padding:5px;display:none;">
        
      <ul class="easyui-tree"> 
        <li iconcls="icon-base"><span>Electron 教程</span><ul><li iconcls="icon-gears"><a href="ELECTRONJiaoChengJianJie.html">Electron 教程简介</a></li><li iconcls="icon-gears"><a  href="ELECTRONKuaiSuRuMen.html">Electron 快速入门</a></li><li iconcls="icon-gears"><a  href="ELECTRONZhuoMianHuanJingJiCheng.html">Electron 桌面环境集成</a></li><li iconcls="icon-gears"><a  href="ELECTRONZaiXianLiXianShiJianTanCe.html">Electron 在线/离线事件探测</a></li><li iconcls="icon-gears"><a  href="ELECTRONJinCheng.html">Electron 进程</a></li><li iconcls="icon-gears"><a  href="ELECTRONZhiChiDeCHROMEMingLingXingKaiGuan.html">Electron 支持的 Chrome 命令行开关</a></li><li iconcls="icon-gears"><a  href="ELECTRONHuanJingBianLiang.html">Electron 环境变量</a></li><li iconcls="icon-gears"><a  href="ELECTRONZhiChiDePingTai.html">Electron 支持的平台</a></li><li iconcls="icon-gears"><a  href="ELECTRONYingYongBuShu.html">Electron 应用部署</a></li><li iconcls="icon-gears"><a  href="ELECTRONXiangMACAPPSTOREYingYongTiJiaoXiangDao.html">Electron 向Mac App Store 应用提交向导</a></li><li iconcls="icon-gears"><a  href="ELECTRONYingYongDaBao.html">Electron 应用打包</a></li><li iconcls="icon-gears"><a  href="ELECTRONShiYongYuanShengMoKuai.html">Electron 使用原生模块</a></li><li iconcls="icon-gears"><a  href="ELECTRONZhuJinChengDiaoShi.html">Electron 主进程调试</a></li><li iconcls="icon-gears"><a  href="ELECTRONShiYongSELENIUMHeWEBDRIVER.html">Electron 使用 Selenium 和 WebDriver</a></li><li iconcls="icon-gears"><a  href="ELECTRONDEVTOOLSKuoZhan.html">Electron DevTools扩展</a></li><li iconcls="icon-gears"><a  href="ELECTRONShiYongPEPPERFLASHChaJian.html">Electron 使用 Pepper Flash 插件</a></li><li iconcls="icon-gears"><a  href="ELECTRONShiYongWIDEVINECDMChaJian.html">Electron 使用 Widevine CDM 插件</a></li><li iconcls="icon-gears"><a  href="ELECTRONShuYuBiao.html">Electron 术语表</a></li><li iconcls="icon-gears"><a  href="ELECTRONLiPingRan.html">Electron 离屏渲染</a></li><li iconcls="icon-gears"><a  href="ELECTRONJiaoHuShiJieShiQiREPL.html">Electron 交互式解释器 (REPL)</a></li></ul></li><li iconcls="icon-base"><span>Electron API</span><ul><li iconcls="icon-gears"><a  href="../ELECTRONAPI/ELECTRONDOMFILEDuiXiang.html">Electron DOM File对象</a></li><li iconcls="icon-gears"><a  href="../ELECTRONAPI/ELECTRONDOMWEBVIEWBiaoQian.html">Electron DOM <webview> 标签</a></li><li iconcls="icon-gears"><a  href="../ELECTRONAPI/ELECTRONWINDOWOPENHanShu.html">Electron window.open 函数</a></li></ul></li><li iconcls="icon-base"><span>在主进程内可用的模块</span><ul><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONAPPMoKuai.html">Electron app 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONAUTOUPDATERMoKuai.html">Electron autoUpdater 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONBROWSERWINDOWMoKuai.html">Electron BrowserWindow 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONCONTENTTRACINGMoKuai.html">Electron contentTracing 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONDIALOGMoKuai.html">Electron dialog 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONGLOBAL-SHORTCUTMoKuai.html">Electron global-shortcut 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONIPCMAINMoKuai.html">Electron ipcMain 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONMENUMoKuai.html">Electron menu 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONMENUITEMMoKuai.html">Electron MenuItem 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONPOWERMONITORMoKuai.html">Electron powerMonitor 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONPOWERSAVEBLOCKERMoKuai.html">Electron powerSaveBlocker 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONPROTOCOLMoKuai.html">Electron protocol 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONSESSIONMoKuai.html">Electron session 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONWEBCONTENTSMoKuai.html">Electron webContents 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONTRAYMoKuai.html">Electron Tray 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiZhuJinChengNeiKeYongDeMoKuai/ELECTRONLOCALES.html">Electron Locales</a></li></ul></li><li iconcls="icon-base"><span>在渲染进程（网页）内可用的模块</span><ul><li iconcls="icon-gears"><a  href="../ZaiRanJinChengWangYeNeiKeYongDeMoKuai/ELECTRONDESKTOPCAPTURERMoKuai.html">Electron desktopCapturer 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiRanJinChengWangYeNeiKeYongDeMoKuai/ELECTRONIPCRENDERERMoKuai.html">Electron ipcRenderer 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiRanJinChengWangYeNeiKeYongDeMoKuai/ELECTRONREMOTEMoKuai.html">Electron remote 模块</a></li><li iconcls="icon-gears"><a  href="../ZaiRanJinChengWangYeNeiKeYongDeMoKuai/ELECTRONWEBFRAMEMoKuai.html">Electron webFrame 模块</a></li></ul></li><li iconcls="icon-base"><span>两种进程都可用的模块</span><ul><li iconcls="icon-gears"><a  href="../LiangZhongJinChengDuKeYongDeMoKuai/ELECTRONCLIPBOARDMoKuai.html">Electron clipboard 模块</a></li><li iconcls="icon-gears"><a  href="../LiangZhongJinChengDuKeYongDeMoKuai/ELECTRONCRASHREPORTERMoKuai.html">Electron crashReporter 模块</a></li><li iconcls="icon-gears"><a  href="../LiangZhongJinChengDuKeYongDeMoKuai/ELECTRONNATIVEIMAGEMoKuai.html">Electron nativeImage 模块</a></li><li iconcls="icon-gears"><a  href="../LiangZhongJinChengDuKeYongDeMoKuai/ELECTRONSCREENMoKuai.html">Electron screen 模块</a></li><li iconcls="icon-gears"><a  href="../LiangZhongJinChengDuKeYongDeMoKuai/ELECTRONSHELLMoKuai.html">Electron shell 模块</a></li></ul></li><li iconcls="icon-base"><span>Electron 开发</span><ul><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONBianMaGuiFan.html">Electron 编码规范</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONYuanMaMuLuJieGou.html">Electron 源码目录结构</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONHeNWJSYuanMingNODE-WEBKITZaiJiShuShangDeChaYi.html">Electron 和 NW.js (原名 node-webkit) 在技术上的差异</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONGouJianXiTongGaiLan.html">Electron 构建系统概览</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONGouJianBuZhouOSX.html">Electron 构建步骤 (OS X)</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONGouJianBuZhouWINDOWS.html">Electron 构建步骤 (Windows)</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONGouJianBuZhouLINUX.html">Electron 构建步骤 (Linux)</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONZaiDiaoShiZhongShiYongSYMBOLSERVER.html">Electron 在调试中使用 Symbol Server</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONChangJianWenTi.html">Electron 常见问题</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONBanBenGuanLi.html">Electron 版本管理</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONWINDOWTiJiaoZhiNan.html">electron window 提交指南</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ZiDongHuaChiXuJiChengXiTongCICeShi.html">自动化持续集成系统（CI）测试</a></li><li iconcls="icon-gears"><a  href="../ELECTRONKaiFa/ELECTRONWenDangFengGeZhiNan.html">Electron 文档风格指南</a></li></ul></li>
      </ul>
    
    </div>
    <div region="center">
      <div id="tt" class="easyui-tabs" fit="true" border="false" plain="true">
        <div title="Electron 支持的 Chrome 命令行开关 - Electron中文手册">  
            <div class="book-content">
              
      <div style="padding:8px;"> &gt; <a href="../index.html">Electron中文手册</a> &gt; Electron 支持的 Chrome 命令行开关</div>
      <div class="content"><p class="comments-section">这页列出了<a href="../../chromedev/index.html">chrome</a>浏览器和Electron支持的命令行开关. 你也可以在<a href="APP.html">app</a>模块的ready事件发出之前使用<a href="APPCOMMANDLINEAPPENDSWITCH.html">app.commandLine.appendSwitch</a> 来添加它们到你应用的main脚本里面:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> app = <span class="hljs-built_in">require</span>(<span class="hljs-string">'electron'</span>).app;
app.commandLine.appendSwitch(<span class="hljs-string">'remote-debugging-port'</span>, <span class="hljs-string">'8315'</span>);
app.commandLine.appendSwitch(<span class="hljs-string">'host-rules'</span>, <span class="hljs-string">'MAP * 127.0.0.1'</span>);

app.on(<span class="hljs-string">'ready'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-comment">// Your code here</span>
});
</code></pre>
<h2 id="clientcertificatepath">--client-certificate=<code>path</code>
</h2>
<p class="comments-section">设置客户端的证书文件 <code>path</code> .</p>
<h2 id="ignoreconnectionslimitdomains">--ignore-connections-limit=<code>DOMains</code>
</h2>
<p class="comments-section">忽略用 <code>,</code> 分隔的 <code>domains</code> 列表的连接限制.</p>
<h2 id="disablehttpcache">--disable-http-cache</h2>
<p class="comments-section">禁止请求 HTTP 时使用磁盘缓存.</p>
<h2 id="remotedebuggingportport">--remote-debugging-port=<code>port</code>
</h2>
<p class="comments-section">在指定的 <code>端口</code> 通过 HTTP 开启远程调试.</p>
<h2 id="jsflagsflags">--js-flags=<code>flags</code>
</h2>
<p class="comments-section">指定引擎过渡到 JS 引擎. </p>
<p class="comments-section">在启动Electron时，如果你想在主进程中激活 <code>flags</code> ，它将被转换.</p>
<pre><code class="lang-bash">$ electron --js-flags=<span class="hljs-string">"--harmony_proxies --harmony_collections"</span> your-app
</code></pre>
<h2 id="proxyserveraddressport">--proxy-server=<code>address:port</code>
</h2>
<p class="comments-section">使用一个特定的代理服务器，它将比系统设置的优先级更高.这个开关只有在使用 HTTP 协议时有效，它包含 HTTPS 和 WebSocket 请求. 值得注意的是，不是所有的代理服务器都支持 HTTPS 和 WebSocket 请求.</p>
<h2 id="proxybypasslisthosts">--proxy-bypass-list=<code>hosts</code>
</h2>
<p class="comments-section">让 Electron 使用(原文:bypass) 提供的以 semi-colon 分隔的hosts列表的代理服务器.这个开关只有在使用 <code>--proxy-server</code> 时有效.</p>
<p>例如:</p>
<pre><code class="lang-javascript">app.commandLine.appendSwitch(<span class="hljs-string">'proxy-bypass-list'</span>, <span class="hljs-string">'&lt;local&gt;;*.google.com;*foo.com;1.2.3.4:5678'</span>)
</code></pre>
<p class="comments-section">将会为所有的hosts使用代理服务器，除了本地地址 (<code>localhost</code>,<code>127.0.0.1</code> etc.), <code>google.com</code> 子域, 以 <code>foo.com</code> 结尾的hosts，和所有类似 <code>1.2.3.4:5678</code>的.</p>
<h2 id="proxypacurlurl">--proxy-pac-url=<code>url</code>
</h2>
<p class="comments-section">在指定的 <code>url</code> 上使用 PAC 脚本.</p>
<h2 id="noproxyserver">--no-proxy-server</h2>
<p class="comments-section">不使用代理服务并且总是使用直接连接.忽略所有的合理代理标志.</p>
<h2 id="hostrulesrules">--host-rules=<code>rules</code>
</h2>
<p class="comments-section">一个逗号分隔的 <code>rule</code> 列表来控制主机名如何映射.</p>
<p>例如:</p>
<ul>
<li>
<code>MAP * 127.0.0.1</code> 强制所有主机名映射到 127.0.0.1</li>
<li>
<code>MAP *.google.com proxy</code> 强制所有 google.com 子域 使用 "proxy".</li>
<li>
<code>MAP test.com [::1]:77</code> 强制 "test.com" 使用 IPv6 回环地址. 也强制使用端口 77.</li>
<li>
<code>MAP * baz, EXCLUDE www.google.com</code> 重新全部映射到 "baz", 除了"www.google.com".</li>
</ul>
<p class="comments-section">这些映射适用于终端网络请求(TCP 连接和 主机解析 以直接连接的方式, 和 <code>CONNECT</code> 以代理连接, 还有 终端 host 使用 <code>SOCKS</code> 代理连接).</p>
<h2 id="hostresolverrulesrules">--host-resolver-rules=<code>rules</code>
</h2>
<p class="comments-section">类似 <code>--host-rules</code> ，但是 <code>rules</code> 只适合主机解析.</p>
<h2 id="ignorecertificateerrors">--ignore-certificate-errors</h2>
<p class="comments-section">忽略与证书相关的错误.</p>
<h2 id="ppapiflashpathpath">--ppapi-flash-path=<code>path</code>
</h2>
<p class="comments-section">设置Pepper Flash插件的路径 <code>path</code> .</p>
<h2 id="ppapiflashversionversion">--ppapi-flash-version=<code>version</code>
</h2>
<p class="comments-section">设置Pepper Flash插件版本号.</p>
<h2 id="lognetlogpath">--log-net-log=<code>path</code>
</h2>
<p class="comments-section">使网络日志事件能够被读写到 <code>path</code>.</p>
<h2 id="sslversionfallbackminversion">--ssl-version-fallback-min=<code>version</code>
</h2>
<p class="comments-section">设置最简化的 SSL/TLS 版本号 ("tls1", "tls1.1" or "tls1.2")，TLS 可接受回退.</p>
<h2 id="ciphersuiteblacklistciphersuites">--cipher-suite-blacklist=<code>cipher_suites</code>
</h2>
<p class="comments-section">指定逗号分隔的 SSL 密码套件 列表实效.</p>
<h2 id="disablerendererbackgrounding">--disable-renderer-backgrounding</h2>
<p class="comments-section">防止 Chr<a href="../../omi/index.html">omi</a>um 降低隐藏的渲染进程优先级.</p>
<p class="comments-section">这个标志对所有渲染进程全局有效，如果你只想在一个窗口中禁止使用，你可以采用 hack 方法playing silent audio.</p>
<h2 id="enablelogging">--enable-logging</h2>
<p class="comments-section">打印 Chromium 信息输出到控制台.</p>
<p class="comments-section">如果在用户应用加载完成之前解析<code>app.commandLine.appendSwitch</code> ，这个开关将实效，但是你可以设置 <code>ELECTRON_ENABLE_LOGGING</code> 环境变量来达到相同的效果.</p>
<h2 id="vloglevel">--v=<code>log_level</code>
</h2>
<p class="comments-section">设置默认最大活跃 V-logging 标准; 默认为 0.通常 V-logging 标准值为肯定值.</p>
<p class="comments-section">这个开关只有在 <code>--enable-logging</code> 开启时有效.</p>
<h2 id="vmodulepattern">--vmodule=<code>pattern</code>
</h2>
<p class="comments-section">赋予每个模块最大的 V-logging levels 来覆盖 <code>--v</code> 给的值.E.g. <code>my_module=2,foo*=3</code> 会改变所有源文件 <code>my_module.*</code> and <code>foo*.*</code> 的代码中的 logging level .</p>
<p class="comments-section">任何包含向前的(forward slash)或者向后的(backward slash)模式将被测试用于阻止整个路径名，并且不仅是E.g模块.<code>*/foo/bar/*=2</code> 将会改变所有在 <code>foo/bar</code> 下的源文件代码中的 logging level .</p>这个开关只有在 <code>--enable-logging</code> 开启时有效.</div>
      <div class="prev-next" style="padding:8px;">上一篇：<a class="prev" href="ELECTRONJinCheng.html">Electron 进程</a><br>下一篇：<a class="prev" href="ELECTRONHuanJingBianLiang.html">Electron 环境变量</a><br></div>
    
            </div>
        </div> 
      </div>
    </div>
  </body>

<!-- Mirrored from www.dba.cn/book/electron/ELECTRONJiaoCheng/ELECTRONZhiChiDeCHROMEMingLingXingKaiGuan.html by HTTrack Website Copier/3.x [XR&CO'2014], Sun, 20 Mar 2022 10:24:05 GMT -->
</html>